package com.cnebula.uas.sso.model;


import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Organization{
	
	final static String CONSTANT_NOSET = "noset" ;

	/****************
	 * 实体关系部分
	 ****************/
	/**
	 * 当前机构的父机构
	 * 对应机构树的上级节点
	 */
	private Organization parent = null;
	/**
	 * 当前机构的下属机构
	 * 对应机构树的下级节点
	 */
	private List<Organization> children = new ArrayList<Organization>();
	/**
	 * 当前机构下的用户
	 */
//	private List<UMPrincipal> principles = new ArrayList<UMPrincipal>();
	
	
	String otherPropertity1;
	
	String otherPropertity2;
	
	String otherPropertity3;

	/****************
	 * 实体属性部分
	 ****************/
	/**
	 * 机构ID
	 * 主键，唯一
	 */
	private String id;// = IDUtil.getId(Organization.class);
	/**
	 * 机构代码
	 */
	private String code;
	/**
	 * <pre>
	 * 机构代码类型
	  <item key="ChinaMOE" defaultLang="zh_CN" >
	      <locale value="教育部馆代码(ChinaMOE)" lang="zh_CN" />
	   </item>
	   <item key="CALIS" defaultLang="zh_CN" >
	      <locale value="CALIS馆代码(CALIS)" lang="zh_CN" />
	   </item>
	   <item key="ChinaStdOrgCode" defaultLang="zh_CN" >
	      <locale value="组织机构代码(ChinaStdOrgCode)" lang="zh_CN" />
	   </item>
	   <item key="otherCode" defaultLang="zh_CN" >
	      <locale value="其他类型代码(otherCode)" lang="zh_CN" />
	   </item>
	 * </pre>
	 */
	private String codeType;
	/**
	 * 机构名称
	 */
	private String name;
	/**
	 * 机构名称缩写
	 */
	private String shortName;
	/**
	 * 机构类型, CALIS成员馆(calisMember), 教育机构（edu）,一般机构（org），公司（com），政府部门(gov), 其他(other)
	 */
	private String type="edu";
	/**
	 * 机构所在省份
	 */
	private String province;
	/**
	 * 机构所在城市
	 */
	private String city;
	/**
	 * 机构网站地址
	 */
	private String homepage;
	
	/**
	 * 扩展属性
	 */
	
	private int version;
	
	/**
	 * 机构完整代码，包括上级机构的代码，
	 * 例如父机构的代码为aaa，自己的机构代码为bbb
	 * 则完整代码为ccc
	 */
	private String completeCode ; 
	
	//是否985
	private String isNineEightFive = CONSTANT_NOSET;
		
	//是否新升本院校
	private String  isNewUpToUndergraduate = CONSTANT_NOSET;
	
	//西部院校类型：取值范围：A类西部院校、B类西部院校。
	private String westCollegeType = CONSTANT_NOSET;
	
    /**共享域类型,虚拟共享域='VirtualSAASCenterInfo',实体共享域='SAASCenterInfo',普通机构='NodeInfo'*/
	private String dType;
	
	public String getdType() {
		return dType;
	}

	public void setdType(String dType) {
		this.dType = dType;
	}

	public int getVersion() {
		return version;
	}

	public void setVersion(int version) {
		this.version = version;
	}

	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	
	public String getCodeType() {
		return codeType;
	}
	public void setCodeType(String codeType) {
		this.codeType = codeType;
	}
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	
	public String getProvince() {
		return province;
	}
	public void setProvince(String province) {
		this.province = province;
	}
	
	public String getCity() {
		return city;
	}
	public void setCity(String city) {
		this.city = city;
	}

	Map<String, String> extAttributes = new HashMap<String, String>();
	
	public Map<String, String> getExtAttributes() {
		return extAttributes;
	}

	public void setExtAttributes(Map<String, String> value) {
		this.extAttributes = value;
	}
	
	
	public Organization(){
	}
	
	public Organization getParent() {
		return parent;
	}
	public void setParent(Organization parent) {
		this.parent = parent;
	}
	
	public List<Organization> getChildren() {
		return children;
	}
	public void setChildren(List<Organization> children) {
		this.children = children;
	}
    public void addSubOrg(Organization child) {
        if (!this.children.contains(child)) {
             this.children.add(child);
             child.setParent(this);
        }
	}
	public void removeChild(Organization child) {
		child.setParent(null); //(null);
		this.children.remove(child);
	}
	
	public String getShortName() {
		return shortName;
	}
	public void setShortName(String shortName) {
		this.shortName = shortName;
	}
	
	public String getHomepage() {
		return homepage;
	}
	public void setHomepage(String homepage) {
		this.homepage = homepage;
	}

	public String getOtherPropertity1() {
		return otherPropertity1;
	}

	public void setOtherPropertity1(String otherPropertity1) {
		this.otherPropertity1 = otherPropertity1;
	}

	public String getOtherPropertity2() {
		return otherPropertity2;
	}

	public void setOtherPropertity2(String otherPropertity2) {
		this.otherPropertity2 = otherPropertity2;
	}

	public String getOtherPropertity3() {
		return otherPropertity3;
	}

	public void setOtherPropertity3(String otherPropertity3) {
		this.otherPropertity3 = otherPropertity3;
	}

	public String getCompleteCode() {
		return completeCode;
	}

	public void setCompleteCode(String completeCode) {
		this.completeCode = completeCode;
	}
	
	public String getIsNineEightFive() {
		return isNineEightFive;
	}

	public void setIsNineEightFive(String isNineEightFive) {
		this.isNineEightFive = isNineEightFive;
	}

	public String getIsNewUpToUndergraduate() {
		return isNewUpToUndergraduate;
	}

	public void setIsNewUpToUndergraduate(String isNewUpToUndergraduate) {
		this.isNewUpToUndergraduate = isNewUpToUndergraduate;
	}

	public String getWestCollegeType() {
		return westCollegeType;
	}

	public void setWestCollegeType(String westCollegeType) {
		this.westCollegeType = westCollegeType;
	}
	
}
